package Command.control;

import Command.commandInterfacesImpl.GatageDoorOpenCommand;
import Command.commons.interfacesImpl.GarageDoor;
import Command.commons.interfacesImpl.Light;
import Command.commandInterfacesImpl.LightOnCommand;

/**
 * @Author: pengzx
 * @Description:
 * @Date: 15:06 2017/9/12
 * @Modified by: 1.0
 */
public class RemoteControlTest {
    public static void main(String[] args)
    {
        SimpleRemoteControl simpleRemoteControl = new SimpleRemoteControl();//调用者
        Light light = new Light("客厅");//请求接受者
        LightOnCommand lightOnCommand = new LightOnCommand(light);//创建一个命令，将接受者传给他

        simpleRemoteControl.setCommand(lightOnCommand);//命令传给调用者
        simpleRemoteControl.buttonWasPressed();//调用命令
        System.out.println("-----------------------------------------------------");

        GarageDoor garageDoor = new GarageDoor();
        GatageDoorOpenCommand gatageDoorOpenCommand = new GatageDoorOpenCommand(garageDoor);

        simpleRemoteControl.setCommand(gatageDoorOpenCommand);
        simpleRemoteControl.buttonWasPressed();
    }
}
